home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / misc.swg / 0139_FLC File Format.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-05-26  |  7.9 KB  |  209 lines

  1. {
  2. > Does anybody out there know how to load .FLC's in TP
  3. > (V/7.0) not .FLI's but .FLC's. I have tried the
  4. > package spx20.zip or whatever and it only had code for
  5. > .FLI's if anyone knows please let me know!:)
  6.  
  7. Look for a file called FLXSPEC.TXT. It's about 30K uncompressed I think.
  8. The .FLC format is a superset of the .FLI. Here are some parts from it:
  9. ==========
  10. The Animator Pro animation file is a good example of a hierarchial
  11. chunked file structure.  The data in an animation file is arranged
  12. as follows:
  13.  
  14.      animation file:
  15.           optional prefix chunk:
  16.                settings chunk
  17.                cel placement chunk
  18.           frame 1 chunk:
  19.                postage stamp chunk:
  20.                     postage stamp data
  21.                color palette chunk
  22.                pixel data chunk
  23.           frame 2 chunk:
  24.                pixel data chunk
  25.           frame 3 chunk:
  26.                color palette chunk
  27.                pixel data chunk
  28.           frame 4 chunk:
  29.                color palette chunk
  30.           ring frame chunk:
  31.                color palette chunk
  32.                pixel data chunk
  33.  
  34.  
  35. FLC - Animator Pro Flic Files
  36.  
  37. This is the main animation file format created by Animator Pro.
  38. The file contains a 128-byte header, followed by an optional
  39. prefix chunk, followed by one or more frame chunks.
  40.  
  41. The prefix chunk, if present, contains Animator Pro settings
  42. information, CEL placement information, and other auxiliary data.
  43.  
  44. A frame chunk exists for each frame in the animation. In
  45. addition, a ring frame follows all the animation frames.  Each
  46. frame chunk contains color palette information and/or pixel data.
  47.  
  48. The ring frame contains delta-compressed information to loop from
  49. the last frame of the flic back to the first.  It can be helpful
  50. to think of the ring frame as a copy of the first frame,
  51. compressed in a different way.  All flic files will contain a
  52. ring frame, including a single-frame flic.
  53.  
  54.  
  55. The FLC file header
  56.  
  57.  
  58. A FLC file begins with a 128-byte header, described below.  All
  59. lengths and offsets are in bytes.  All values stored in the
  60. header fields are unsigned.
  61.  
  62. Offset  Length  Name         Description
  63.  
  64.   0       4     size         The size of the entire animation file,
  65.                              including this file header.
  66.  
  67.   4       2     magic        File format identifier. Always hex AF12.
  68.  
  69.   6       2     frames       Number of frames in the flic.  This
  70.                              count does not include the ring frame.
  71.                              FLC files have a maximum length of 4000
  72.                              frames.
  73.  
  74.   8       2     width        Screen width in pixels.
  75.  
  76.   10      2     height       Screen height in pixels.
  77.  
  78.   12      2     depth        Bits per pixel (always 8).
  79.  
  80.   14      2     flags        Set to hex 0003 after ring frame is
  81.                              written and flic header is updated.
  82.                              This indicates that the file was properly
  83.                              finished and closed.
  84.  
  85.   16      4     speed        Number of milliseconds to delay between
  86.                              each frame during playback.
  87.  
  88.   20      2     reserved     Unused word, set to 0.
  89.  
  90.   22      4     created      The MSDOS-formatted date and time of the
  91.                              file's creation.
  92.  
  93.   26      4     creator      The serial number of the Animator Pro
  94.                              program used to create the file.  If the
  95.                              file was created by some other program
  96.                              using the FlicLib development kit, this
  97.                              value is hex 464C4942 ("FLIB").
  98.  
  99.   30      4     updated      The MSDOS-formatted date and time of the
  100.                              file's most recent update.
  101.  
  102.   34      4     updater      Indicates who last updated the file.  See
  103.                              the description of creator.
  104.  
  105.   38      2     aspectx      The x-axis aspect ratio at which the file
  106.                              was created.
  107.  
  108.   40      2     aspecty      The y-axis aspect ratio at which the file
  109.                              was created. Most often, the x:y aspect ratio
  110.                              will be 1:1.  A 320x200 flic has a ratio of
  111.                              6:5.
  112.  
  113.   42      38    reserved     Unused space, set to zeroes.
  114.  
  115.   80      4     oframe1      Offset from the beginning of the file to the
  116.                              first animation frame chunk.
  117.  
  118.   84      4     oframe2      Offset from the beginning of the file to
  119.                              the second animation frame chunk.  This value
  120.                              is used when looping from the ring frame back
  121.                              to the second frame during playback.
  122.  
  123.   88      40    reserved     Unused space, set to zeroes.
  124.  
  125.  
  126. The FLC prefix chunk
  127.  
  128. An optional prefix chunk may immediately follow the animation
  129. file header.  This chunk is used to store auxiliary data which is
  130. not directly involved in the animation playback.  The prefix
  131. chunk starts with a 16-byte header (identical in structure to a
  132. frame header), as follows:
  133.  
  134. Offset  Length  Name         Description
  135.  
  136.   0       4     size         The size of the prefix chunk, including
  137.                              this header and all subordinate chunks
  138.                              that follow.
  139.  
  140.   4       2     type         Prefix chunk identifier. Always hex F100.
  141.  
  142.   6       2     chunks       Number of subordinate chunks in the
  143.                              prefix chunk.
  144.  
  145.   8       8     reserved     Unused space, set to zeroes.
  146.  
  147. To determine whether a prefix chunk is present, read the 16-byte
  148. header following the file header.  If the type value is hex F100,
  149. it's a prefix chunk.  If the value is hex F1FA it's the first
  150. frame chunk, and no prefix chunk exists.
  151.  
  152. ....
  153.  
  154. The FLC frame chunks
  155.  
  156. Frame chunks contain the pixel and color data for the animation.
  157. A frame chunk may contain multiple subordinate chunks, each
  158. containing a different type of data for the current frame.  Each
  159. frame chunk starts with a 16-byte header that describes the contents
  160. of the frame:
  161.  
  162. Offset  Length  Name         Description
  163.  
  164.   0       4     size         The size of the frame chunk, including this
  165.                              header and all subordinate chunks that follow.
  166.  
  167.   4       2     type         Frame chunk identifier. Always hex F1FA.
  168.  
  169.   6       2     chunks       Number of subordinate chunks in the
  170.                              frame chunk.
  171.  
  172.   8       8     reserved     Unused space, set to zeroes.
  173.  
  174.  
  175. Immediately following the frame header are the frame's subordinate
  176. data chunks.  When the chunks count in the frame header is zero, it
  177. indicates that this frame is identical to the previous frame.  This
  178. implies that no change is made to the screen or color palette, but
  179. the appropriate delay is still inserted during playback.
  180.  
  181. Each data chunk within a frame chunk is formatted as follows:
  182.  
  183. Offset  Length  Name         Description
  184.  
  185.   0       4     size         The size of the chunk, including this header.
  186.  
  187.   4       2     type         Data type identifier.
  188.  
  189.   6    (size-6) data         The color or pixel data.
  190.  
  191.  
  192. The type values in the chunk headers indicate what type of graphics
  193. data the chunk contains and which compression method was used to
  194. encode the data.  The following values (and their associated mnemonic
  195. names) are currently found in frame data chunks:
  196.  
  197. Value     Name        Description
  198.  
  199.   4    FLI_COLOR256   256-level color palette info
  200.   7    FLI_SS2        Word-oriented delta compression
  201.   11   FLI_COLOR      64-level color palette info
  202.   12   FLI_LC         Byte-oriented delta compression
  203.   13   FLI_BLACK      Entire frame is color index 0
  204.   15   FLI_BRUN       Byte run length compression
  205.   16   FLI_COPY       No compression
  206.   18   FLI_PSTAMP     Postage stamp sized image
  207.  
  208.  
  209.